#!/usr/bin/python
#-*-coding: utf-8 -*-

from raytracing_classes import *
from PIL import Image
import math

wRes  = 320 #Bildbreite
hRes = 240 #Bildhöhe
BACKGROUND_COLOR = (0,0,0)
aspectratio = float(wRes/hRes) #Seitenverhältnis


def generate_picture(image):
    global aspectratio
    # Kamera hinzufügen
    cam = Camera(Point(0,2,10),Point(0,3,0),45,aspectratio)
    # Objekte erzeugen
    objectlist = []
    objectlist.append(Sphere(Point(2.5,3,-10),2))       # Kugel: rot
    objectlist.append(Sphere(Point(-2.5,3,-10),2))      # Kugel: gruen
    objectlist.append(Sphere(Point(0,7,-10),2))         # Kugel: blau
    objectlist.append(Plane(Point(0,0,0),Vector(1,0,0))) # Ebene: Grau
    # Lichtquelle erzeugen
    light = Light(point(30,30,10))

    # Bild berechnen

    image = cam.rayCasting(image)
    


if __name__ == '__main__':
    #Bildobjekt erzeugen
    im = Image.new("RGB",(wRes,hRes))
    
    #Welt erzeugen
    generate_picture(im)

    # start
    im.save("raycastingPic.png")

